import presetWeapp from "unocss-preset-weapp";
import { extractorAttributify, transformerClass } from "unocss-preset-weapp/transformer";
import transformerDirectives from '@unocss/transformer-directives'
import { presetIcons } from 'unocss'

const { presetWeappAttributify, transformerAttributify } =
  extractorAttributify();

export default {
  presets: [
    // https://github.com/MellowCo/unocss-preset-weapp
    presetWeapp(),
    // attributify autocomplete
    presetWeappAttributify(),
    // https://icones.js.org
    presetIcons()

  ],
  shortcuts: [
    {
      // 布局
      "flex-center": "flex justify-center items-center",
      "flex-x-center": "flex justify-center",
      "flex-y-center": "flex items-center",
      "i-flex-center": "inline-flex justify-center items-center",
      "i-flex-x-center": "inline-flex justify-center",
      "i-flex-y-center": "inline-flex items-center",
      "flex-col": "flex flex-col",
      "flex-col-stretch": "flex-col items-stretch",
      "i-flex-col": "inline-flex flex-col",
      "i-flex-col-stretch": "i-flex-col items-stretch",
      "wh-full": "w-full h-full",
      // 字体颜色
      "text-primary": "text-#333",
      "text-regular": "text-#666",
      "text-secondary": "text-#999",
			// 边框
			"border-primary": "b-0 border-solid border-#f1f1f1",
			// 背景色
			"bg-primary": "bg-#F8F8F8",
    },
  ],

  transformers: [
		transformerDirectives({
			enforce: 'pre',
	}),

    // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerAttributify
    transformerAttributify(),

    // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
    transformerClass(),
  ],
};
